package main

import (
	"context"
	"fmt"
	"time"

	"go.etcd.io/etcd/client/v3"
)

// GetSet
func main() {

	cfg := clientv3.Config{
		Endpoints: []string{"192.168.0.121:2379"},

		DialTimeout: 5 * time.Second,
	}

	client, err := clientv3.New(cfg)
	if err != nil {
		fmt.Println(err)
		return
	}

	kv := clientv3.NewKV(client)

	putResp, err := kv.Put(context.TODO(), "/cron/jobs/job1", "hello2", clientv3.WithPrevKV())
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println("Revision", putResp.PrevKv)
	}

}
